import hotentUi from '@/index'

const data = Object.keys(hotentUi.HtIcon.icons)

export function getIconList(query) {
  return new Promise((resolve) => {
    const { title, pageNo = 1, pageSize = 72 } = query
    let mockList = data.filter((item) => {
      if (title && item.indexOf(title) < 0) return false
      return true
    })
    const pageList = mockList.filter(
      (item, index) =>
        index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
    )
    resolve({
      code: 200,
      msg: 'success',
      totalCount: mockList.length,
      data: pageList,
    })
  })
}
